package vd

import "math/big"


type Transformer struct {
	*Serializer
	*Deserializer
}

type Serializer struct {
	ReflectInward  func(Object) Object
	DetermineType  func(Object) *Type
	PrimitiveSerializer
	ContainerSerializer
	AlgebraicSerializer
}
type PrimitiveSerializer struct {
	WriteBool     func(Object) bool
	WriteFloat    func(Object) float64
	WriteComplex  func(Object) complex128
	WriteInteger  func(Object) *big.Int
	WriteString   func(Object) string
	WriteBinary   func(Object) ([] byte)
}
type ContainerSerializer struct {
	IterateArray  func(Object, func(uint,Object) error) error
	UnwrapMaybe   func(Object) (Object, bool)
}
type AlgebraicSerializer struct {
	IterateRecord   func(Object, func(string,Object) error) error
	Enum2Case       func(Object) Object
}

type Deserializer struct {
	ReflectOutward  func(Object) Object
	PrimitiveDeserializer
	ContainerDeserializer
	AlgebraicDeserializer
}
type PrimitiveDeserializer struct {
	Unit         Object
	ReadBool     func(bool) Object
	ReadFloat    func(float64) Object
	ReadComplex  func(complex128) Object
	ReadInteger  func(*big.Int) (Object, bool)
	ReadString   func(string) Object
	ReadBinary   func([] byte) Object
}
type ContainerDeserializer struct {
	CreateArray  func(array_t *Type) (Object, error)
	AppendItem   func(array_ptr *Object, item Object) error
	MaybeSome    func(obj Object, opt_t *Type) (Object, error)
	MaybeNone    func(opt_t *Type) (Object, error)
}
type AlgebraicDeserializer struct {
	AssignObject  func(obj Object, from *Type, to *Type) (Object, error)
	CreateRecord  func(record_t TypeId, size uint) (Object, func(string)(RecordField,bool), error)
	FillField     func(record Object, index uint, value Object)
	FinishRecord  func(record Object, t TypeId) (Object, error)
	Case2Enum     func(obj Object, enum_t TypeId, case_t TypeId) (Object, error)
}


